package com.wenhai.spring.annotation;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;

/**
 * {@link Component} 扫描示例
 *
 * @author wenhai
 * @date 2020/9/10
 * @see Component
 * @see ComponentScan
 */
//@ComponentScan("com.wenhai.spring.annotation")
@MyComponentScan("com.wenhai.spring.annotation")
public class ComponentScanDemo {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ComponentScanDemo.class);
        // 多层次派生在 Spring4 给予支持
        TestClass testClass = ctx.getBean(TestClass.class);
        System.out.println(testClass);
        ctx.close();
    }
}
